package com.jeomo.masterdata.starter.mapper;

import com.jeomo.base.starter.mapper.IBaseMapper;
import com.jeomo.masterdata.starter.entity.Region;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author:Jackpot
 * @create 2020-11-03 19:31
 * @description:
 */
@Mapper
public interface RegionMapper extends IBaseMapper<Region> {

    /**
     * 查询区域信息
     * @param pid 父ID
     * @return
     */
    @Select("select m.id,m.`name`,m.pid,m.`level`,m.mername from region as m where m.pid=#{pid}")
    List<Region> queryRegionsByPid(Integer pid);


    @Select("select m.id,m.`name`,m.pid,m.`level`,m.mername from region as m where m.id=#{id}")
    Region queryRegionById(Integer id);
}
